﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls.Common="clr-namespace:Imagin.Controls.Common;assembly=Imagin.Controls.Common">
    <Style x:Key="{x:Type RadioButton}" TargetType="{x:Type RadioButton}">
        <Setter Property="Background" Value="{DynamicResource Brush.RadioButton.Background}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.RadioButton.Border}" />
        <Setter Property="BorderThickness" Value="2" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{DynamicResource Brush.RadioButton.Foreground}" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RadioButton}">
                    <BulletDecorator 
                        Background="Transparent" 
                        Cursor="{TemplateBinding Cursor}">
                        <BulletDecorator.Bullet>
                            <Grid  
                                ClipToBounds="False"
                                VerticalAlignment="Center">
                                <Border 
                                    Background="{TemplateBinding Background}"
                                    BorderBrush="{TemplateBinding BorderBrush}"
                                    BorderThickness="{TemplateBinding BorderThickness}" 
                                    ClipToBounds="False" 
                                    CornerRadius="999"
                                    Height="16"
                                    Width="16" >
                                    <Ellipse 
                                        x:Name="PART_Tick" 
                                        Fill="{DynamicResource Brush.RadioButton.Tick.Stroke}"
                                        HorizontalAlignment="Stretch" 
                                        Margin="1" 
                                        VerticalAlignment="Stretch" />
                                </Border>
                            </Grid>
                        </BulletDecorator.Bullet>
                        <TextBlock 
                            Margin="12,2,0,0" 
                            Foreground="{TemplateBinding Foreground}" 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                            <InlineUIContainer><ContentPresenter/></InlineUIContainer>
                        </TextBlock>
                    </BulletDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="PART_Tick" Property="Visibility" Value="Visible" />
                        </Trigger>
                        <Trigger Property="IsChecked" Value="False">
                            <Setter TargetName="PART_Tick" Property="Visibility" Value="Collapsed" />
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.6" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="{x:Type Controls.Common:RadioGroup}" TargetType="{x:Type Controls.Common:RadioGroup}">
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.RadioButton.Border}"/>
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="CornerRadius" Value="4"/>
        <Setter Property="Foreground" Value="{DynamicResource Brush.RadioButton.Foreground}"/>
        <Setter Property="Padding" Value="7,5"/>
    </Style>
</ResourceDictionary>